import Axios from '@/utils/request';
import { string } from 'postcss-selector-parser';

export interface IDynamic {
    dynamicCode?: string;
    dynamicName?: string;
    dynamicType?: string;
    groupType?: string;
    operatorName?: string;
    separateValid?: boolean;
    sourceCode?: string;
    sourceType?: string;
    label?: string;
    id?: string;

    [propName: string]: any;
}
/**
 * 获取动态维度数据
 */
export const getDynamicBoundList = (): Promise<IDynamic[]> => {
    return Axios.post('/dynamic/list');
};

// 获取动态维度详情数据
export const getDynamicStockList = (data: { dynamicCode: string; stockCode?: string; paging: any }): Promise<any> => {
    return Axios.post('/dynamic/stockList/dynamicCode', data);
};

/**
 * 删除动态维度
 */
export function deleteDynamicBound(data: string[]): Promise<any[]> {
    return Axios.delete('/dynamic/delete/dynamicCodes', { data });
}

/**
 * 获取证券信息列表
 */
export const originalStockList = (data): Promise<any> => {
    return Axios.post('/original/stock/list', data);
};

/**
 * 获取动态维度下的范围配置
 */
export function getDynamicBoundConfig(code): Promise<any> {
    return Axios.get('/dynamic/bondCfg/' + code);
}

/**
 * 更新动态维度
 */
export function updateDynamicBound(data): Promise<any> {
    return Axios.post('/dynamic/update', data);
}

/**
 * 添加动态维度
 */
export function addDynamicBound(data): Promise<any> {
    return Axios.post('/dynamic/insert', data);
}

// 查询满足条目状态的条目 status 1-启用 ，0-禁用
export function queryEntryCodesByStatus(status: string, entryCodes: string[]): Promise<any> {
    const urlH = '/entry';
    return Axios.post(urlH + '/entryCodesByStatus/' + status, entryCodes);
}

/**
 * 获取资产单元组数据
 */
export function getAssetGroup(): Promise<any> {
    return Axios.get('/assetGroup/list');
}

/**
 * 获取投资组合组数据
 */
export function getFdAcGroup(): Promise<any> {
    return Axios.get('/fdAcGroup/list');
}
/**
 * 查询黑白名单条目信息
 */
export const getBlackWhite = (data): Promise<any> => {
    return Axios.post('/syncLmtCode/list', data);
};

/**
 * 获取黑名单标志位
 */
export const querySystemByParamKey = (): Promise<any> => {
    return Axios.post('/syncLmtCode/querySystemByParamKey');
};

/**
 * 更新黑白标志位
 */
export const updateSystemByParamKey = (data): Promise<any> => {
    return Axios.post('/syncLmtCode/updateSystemByParamKey', data);
};

/**
 * 黑白名单移出
 */
export const handleExplantaTion = (): Promise<any> => {
    return Axios.post('/syncLmtCode/inserLimitCode/explantaTion');
};

/**
 * 黑白名单移入
 */
export const handleImmigraTion = (data: any): Promise<any> => {
    return Axios.post('/syncLmtCode/inserLimitCode/ImmigraTion', data);
};

/**
 * 对比(条目同步)
 * 参数:sourceType,sourceCode,noExistsEntryCodes
 */
export const compareEntryCode = (data): Promise<any> => {
    return Axios.post('/syncLmtCode/compareEntryCode', data);
};

/**
 * 对比(黑白名单移出)
 * 参数:noExistsEntryCodes,lmtType
 */
export const compareSyncLmtEntryCode = (data): Promise<any> => {
    return Axios.post('/syncLmtCode/compareSyncLmtEntryCode', data);
};

/**
 * 插入已选择条目
 */
export const inserSelectEntryCode = (data): Promise<any> => {
    return Axios.post('/syncLmtCode/inserSelectEntryCode', data);
};

/**
 * 查询已选择条目信息
 */
export const selectByEntryCode = (data): Promise<any> => {
    return Axios.post('/syncLmtCode/selectByEntryCode', data);
};
